
import pygame
import gamestate
import input
import gfx
import entities
import data
import soundmachine
import ui_backend
import statemachine
from graphicalscene import *


WIDTH = 800
HEIGHT = 600
FPS = 60

TEXTPADDING = 2

BLACK = (0, 0, 0);
WHITE = (255, 255, 255)
DARKGRAY = (50, 50, 50)
LIGHTGRAY = (100, 100, 100)


TOOLTIPFG = WHITE
TOOLTIPBG = LIGHTGRAY
ELEMENTIDLE = DARKGRAY
ELEMENTACTIVE = LIGHTGRAY

FILL = 0
OUTLINE = 1


class Frame(object):
    
    def run(self):
        ui_backend.init_ui()
        
        pygame.mixer.init()
        pygame.mixer.music.load(data.filepath("Audio/pianowithwind.mp3"))
        soundmachine.SoundMachine.LoadAllSounds()
        pygame.mixer.music.play(-1)
        
        soundmachine.SoundMachine.PlayInitialSound()
        
        initialize_on_startup()
        
        self._mainloop()
    
    def _mainloop(self):
        stateMachine = statemachine.StateMachine()
        
        while not input.quit:
            input.process()
            stateMachine.tick()
            ui_backend.end_frame()
        # quit now:
        pygame.quit()